<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <script>
            //命名捕获分组
            // const str = '<a href ="https://www.baidu.com">百度</a>';
            // const reg = /<a href ="(?<url>.*)">(?<text>.*)<\/a>/;
            //     const result = reg.exec(str);
            // console.log(result.groups.url);
            //正向断言
            const str = "sjd432435卡路里23";
            // const reg = /\d+(?=卡)/;
            //正向否定断言
            // const reg = /\d+(?!卡)/;
            //反向断言
            // const reg = /(?<=里)\d+/;
            //反向否定断言
            const reg = /^(?<!里)\d+$/;
            console.log(reg.exec(str));

            //dotAll模式，即给 . 加上s,匹配所有字符
        </script>
    </body>
</html>